Swing: easiest way to align width of [dynamic][static][dynamic] components?
Posted
by
java.is.for.desktop
on Stack Overflow
See other posts from Stack Overflow
or by java.is.for.desktop
Published on 2010-12-21T00:19:51Z
Indexed on
2010/12/21
23:54 UTC
Read the original article
Hit count: 151
What is the easiest way in standard Java Swing to align three components in such a way that:
the dynamic widths of
Component1
andComponent3
are adjusted to be equal,while
Component2
(which is in between) has constant width?
Imagine we have some resizable JPanel (such as inside a JFrame).
Small width should look like this:
[----------------whole JPanel----------------]
[--Component1--] [Component2] [--Component3--]
Big width should look like this:
[------------------------whole JPanel------------------------]
[------Component1------] [Component2] [------Component3------]
Note: I just "trialed-and-errored" with GroupLayout
for too long.
© Stack Overflow or respective owner